<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Complaint;
use App\Models\Monitor;
use App\Models\Notice;
use App\Models\Scene;
use Encore\Admin\Controllers\Dashboard;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;
use Encore\Admin\Widgets\InfoBox;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->header('常德智慧旅游综合管控平台')
            ->row(Dashboard::title())
            ->row(function (Row $row) {
                $row->column(3, function (Column $column) {
                    $column->append(new InfoBox('景区', 'bookmark', 'aqua', '/admin/category/scene',Scene::count()));
                });
                $row->column(3, function (Column $column) {
                    $column->append(new InfoBox('监控', 'exclamation-triangle', 'yellow', '/admin/monitor/monitor', Monitor::count()));
                });
                $row->column(3, function (Column $column) {
                    $column->append(new InfoBox('旅游通知', 'bell', 'green', '/admin/notice', Notice::count()));
                });
                $row->column(3, function (Column $column) {
                    $column->append(new InfoBox('旅游投诉', 'commenting-o', 'red', '/admin/integrity/unhandle', Complaint::where('status',0)->count()));
                });
            });
    }
}
